﻿using System;
using System.Collections.Generic;
using System.Linq;
using DLM.Domain.Model;
using DLM.Domain.Repositories;
using DLM.Infrastructure.UnitOfWork;
using DLM.Infrastructure.Domain;

namespace DLM.Data.EF.CodeFirst.Repositories
{
   public class AdminUserRepository:Repository<AdminUser,int>,IAdminUserRepository
    {

       public AdminUserRepository(IUnitOfWork unitOfWork)
           : base(unitOfWork)
       { }


        public new System.Collections.IEnumerator GetEnumerator()
        {
            throw new NotImplementedException();
        }

        public AdminUser FindByName(string adminName)
        {
            if (string.IsNullOrEmpty(adminName))
            {
                throw new ArgumentNullException("Name cannot be null!");
            }
            return this.ActiveContext.AdminUser.FirstOrDefault(a => a.Administrator == adminName);
        }
    }
}
